<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>父传子</title>
		<script src="js/vue.js" type="text/javascript" charset="utf-8"></script>
	</head>
	<body>
		<div id="box">
			<child ref="child"></child>
            <div ref="mychild">mychild</div>
            <button @click="handleClick">click</button>
        </div>
        <script>
            Vue.component("child",{
				template:`<div>这是child的组件</div>`,
				data() {
					return {
						str:"wodezujian"
					}
				}
			})
           
            //根组件
            var vm = new Vue({
                el:"#box",
                methods:{
                    handleClick(){
                        console.log(this.$refs.child.str)
                    }
                }
            })
        </script>
	</body>
</html>
